include ../Makefile.include

version   := 5.5p1
build_dir := $(software)-$(version)
source    := $(build_dir).tar.gz

$(build_dir)/Makefile: $(source)
	-rm -rf $(build_dir)
	tar zxvf $(source)
	cd $(build_dir);./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib --sysconfdir=/etc/ssh --libexecdir=/usr/lib/misc --datadir=/usr/share/openssh --disable-suid-ssh --with-privsep-path=/var/empty --with-privsep-user=sshd --with-md5-passwords --without-kerberos5 --without-tcp-wrappers --without-skey --without-opensc --with-pam --with-ipv4-default --without-zlib-version-check --without-openssl-header-check --without-rand-helper

$(package): $(build_dir)/Makefile
	-rm -rf tmp
	make -C $(build_dir) install-nokeys DESTDIR=`pwd`/_install
	install -D _install/usr/sbin/sshd tmp/usr/sbin/sshd
	install -D _install/usr/bin/ssh tmp/usr/bin/ssh
	install -D _install/usr/bin/scp tmp/usr/bin/scp
	install -D _install/usr/lib/misc/sftp-server tmp/usr/lib/misc/sftp-server
	install -D sshd_config tmp/etc/ssh/sshd_config
	install -D ssh_config tmp/etc/ssh/ssh_config
	install -D authorized_keys tmp/root/.ssh/authorized_keys
	install -D rt_sync_auth tmp/root/.ssh/rt_sync_auth
	install -D S00sshd tmp/etc/init.d/sshd
	mkdir -p tmp/var/empty
	cp keys/* tmp/etc/ssh/
	chmod 600 tmp/etc/ssh/ssh_host_rsa_key
	chmod 600 tmp/etc/ssh/ssh_host_dsa_key
	tar -C tmp -cpzf $@ .

clean: $(software)_clean
	-rm -rf _install $(build_dir)

